#pragma once

#include "includeBase.h"

class GuiBuilder
{
public:
    GuiBuilder();
    ~GuiBuilder();

    void done();
    inline GuiBuilder& setMainWindow(QMainWindow* main)
    {
        main_ = main;
        return *this;
    }
    GuiBuilder& setMenuBar(QMenuBar* menubar);
    GuiBuilder& addMenu(const QString& title, const QString& name = "");
    GuiBuilder& addMenuAction(QAction* action);
    GuiBuilder& addMenuSeparator();

    GuiBuilder& addToolBar(
        QWidget* parent,
        std::function<void(QToolBar*)> postAction = nullptr
    );
    GuiBuilder& setToolBar(QToolBar* toolbar);
    GuiBuilder& addToolBarAction(QAction* action);
    GuiBuilder& addToolBarAction(
        const QString& title,
        const QIcon& icon,
        std::function<void(QAction*)> postAction = nullptr
    );
    GuiBuilder& addToolBarSeparator();

    GuiBuilder& setGridLayout(QWidget* parent);
    GuiBuilder& setTabWidget(QTabWidget* tabWidget);
    GuiBuilder& addTabWidget(
        std::function<void(QTabWidget*)> postAction = nullptr
    );
    GuiBuilder& addTab(QWidget* widget, const QString& title);

    GuiBuilder& addDock(
        QWidget* widget,
        const QString title,
        Qt::DockWidgetArea area
    );

private:
    QMainWindow* main_ = nullptr;
    QMenuBar* menubar_ = nullptr;
    QMenu* menu_ = nullptr;
    QToolBar* toolbar_ = nullptr;
    QGridLayout* gridLayout_ = nullptr;
    QTabWidget* tabWidget_ = nullptr;
};
